package com.xhj.controller;

import com.xhj.util.ResultEntity;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/EduAdmin/user/")
@CrossOrigin // 设置跨域请求
public class LoginController {

    @ApiOperation(value = "登录请求")
    @RequestMapping("login")
    public ResultEntity login(){
//        String[] roles = {"admin"};
//        Token token = new Token(roles,"I am a super administrator","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif","Super Admin");
        return ResultEntity.successWithData().data("token","admin");
    }

    @ApiOperation(value = "获取用户信息")
    @RequestMapping("info")
    public ResultEntity getInfo(){

        return ResultEntity.successWithData().data("name","admin")
                                             .data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }
}
